let SwiperItem = function() {
    this.id = 0;
    this.priority = 0;
    this.url = "";
    this.activityId = 0;
    this.startTime = 0;
    this.endTime = 0;
};

SwiperItem.prototype.toBSON = function() {
    return {
        id : this.id,
        priority : this.priority,
        url : this.url,
        activityId : this.activityId,
        startTime : this.startTime,
        endTime : this.endTime,
    };
};

SwiperItem.prototype.toJSON = function () {
    return {
        id : this.id,
        priority : this.priority,
        url : this.url,
        activityId : this.activityId,
        startTime : this.startTime,
        endTime : this.endTime,
    };
};

module.exports.create = function(id, priority, url, activityId, startTime, endTime) {
    let swiperItem = new SwiperItem();
    swiperItem.id = id;
    swiperItem.priority = priority;
    swiperItem.url = url;
    swiperItem.activityId = activityId;
    swiperItem.startTime = startTime;
    swiperItem.endTime = endTime;
    return swiperItem;
};

module.exports.loadFromDocument = function (document) {
    let swiperItem = new SwiperItem();
    swiperItem.id = document["id"];
    swiperItem.priority = document["priority"];
    swiperItem.url = document["url"];
    swiperItem.activityId = document["activityId"];
    swiperItem.startTime = document["startTime"];
    swiperItem.endTime = document["endTime"];
    return swiperItem;
};
